


import request from '@/utils/request.ts'

// 获取地址列表 数据
export const getAddressList = ({ userid }) => {
    return request({
        url: '/address/list',
        method: 'get',
        params: { userid }
    })
}


/*

userid	      String    用户id
name	      String    收货人姓名
tel	          String    收货人手机号
province	  String    省
city	      String    市
county	      String    区
addressDetail String	详细地址
isDefault	  Boolean	默认地址
// userid ,name ,tel ,province ,city ,county ,addressDetail ,isDefault	 

*/

export const getAddAddress = ({ userid ,name ,tel ,province ,city ,county ,addressDetail ,isDefault	 }) => {
    return request({
        url: '/address/add',
        method: 'get',
        params: {
            userid ,name ,tel ,province ,city ,county ,addressDetail ,isDefault	
        }
    })
}


// 新增地址接口
export const getAdd = ({data})=>{
    return request({
        url:'address/add',
        method: 'post',
        data: { data },
    })
}


// 查询地址接口
export const queryAddress = ({ userid })=>{
    return request({
        url:'address/defaultAddress',
        method: 'post',
        data: { userid },
    })
}


// 更新地址接口
export const updateAddress = ({data})=>{
    return request({
        url:'address/update',
        method: 'post',
        data: { data },
    })
}

// 删除地址接口
export const deleteAddress = ({ addressid })=>{
    return request({
        url:'address/delete',
        method: 'post',
        data: { addressid },
    })
}